<?php
namespace Index\Controller;
use Think\Controller;
class PeopleController extends Controller {
    public function index(){
        $this->display();

    }


//**************发表问题 将数据插入数据库
    public function publish(){
	    	//循环问题分类
            $link =M();
            $sql_cate ="select * from category where fid=0";

            $data = $link->query($sql_cate);
            // var_dump($data);exit();
            $this->assign('data',$data);
    	if ($_POST) {
            $data = array();
    		$data['title'] = I('post.title');
    		$data['qid']  = I('post.category_id');//问题分类
    		$data['content'] = I('post.editorValue');
    		$data['time'] =date("Y-m-d H:m:i");
    		$data['uid']  = $_SESSION['id'];//当前用户ID

            $id = M('question')->add($data);//TP的add方法执行产生一个自增ID

            $this->success('发表成功!',U('index/index/question/',array('id'=>$id)));

    	}else{

            

            $this->display();
        }
        
    }


	public function ueditor(){
    	$data = new \Org\Util\Ueditor();
		echo $data->output();

    }


    
}